Optimal. Leaf size=78 \[ -\frac{a^2 \cot (c+d x)}{d}+a^2 (-x)+\frac{2 a b \cos (c+d x)}{d}-\frac{2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac{b^2 \sin (c+d x) \cos (c+d x)}{2 d}+\frac{b^2 x}{2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.0855624, antiderivative size = 78, normalized size of antiderivative = 1., number of steps used = 9, number of rules used = 7, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.333, Rules used = {2722, 2635, 8, 2592, 321, 206, 3473} \[ -\frac{a^2 \cot (c+d x)}{d}+a^2 (-x)+\frac{2 a b \cos (c+d x)}{d}-\frac{2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac{b^2 \sin (c+d x) \cos (c+d x)}{2 d}+\frac{b^2 x}{2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 2722
Rule 2635
Rule 8
Rule 2592
Rule 321
Rule 206
Rule 3473
Rubi steps
\begin{align*} \int \cot ^2(c+d x) (a+b \sin (c+d x))^2 \, dx &=\int \left (b^2 \cos ^2(c+d x)+2 a b \cos (c+d x) \cot (c+d x)+a^2 \cot ^2(c+d x)\right ) \, dx\\ &=a^2 \int \cot ^2(c+d x) \, dx+(2 a b) \int \cos (c+d x) \cot (c+d x) \, dx+b^2 \int \cos ^2(c+d x) \, dx\\ &=-\frac{a^2 \cot (c+d x)}{d}+\frac{b^2 \cos (c+d x) \sin (c+d x)}{2 d}-a^2 \int 1 \, dx+\frac{1}{2} b^2 \int 1 \, dx-\frac{(2 a b) \operatorname{Subst}\left (\int \frac{x^2}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d}\\ &=-a^2 x+\frac{b^2 x}{2}+\frac{2 a b \cos (c+d x)}{d}-\frac{a^2 \cot (c+d x)}{d}+\frac{b^2 \cos (c+d x) \sin (c+d x)}{2 d}-\frac{(2 a b) \operatorname{Subst}\left (\int \frac{1}{1-x^2} \, dx,x,\cos (c+d x)\right )}{d}\\ &=-a^2 x+\frac{b^2 x}{2}-\frac{2 a b \tanh ^{-1}(\cos (c+d x))}{d}+\frac{2 a b \cos (c+d x)}{d}-\frac{a^2 \cot (c+d x)}{d}+\frac{b^2 \cos (c+d x) \sin (c+d x)}{2 d}\\ \end{align*}
Mathematica [A] time = 0.416328, size = 116, normalized size = 1.49 \[ \frac{2 a^2 \tan \left (\frac{1}{2} (c+d x)\right )-2 a^2 \cot \left (\frac{1}{2} (c+d x)\right )-4 a^2 c-4 a^2 d x+8 a b \cos (c+d x)+8 a b \log \left (\sin \left (\frac{1}{2} (c+d x)\right )\right )-8 a b \log \left (\cos \left (\frac{1}{2} (c+d x)\right )\right )+b^2 \sin (2 (c+d x))+2 b^2 c+2 b^2 d x}{4 d} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.039, size = 102, normalized size = 1.3 \begin{align*} -{a}^{2}x-{\frac{{a}^{2}\cot \left ( dx+c \right ) }{d}}-{\frac{{a}^{2}c}{d}}+2\,{\frac{ab\cos \left ( dx+c \right ) }{d}}+2\,{\frac{ab\ln \left ( \csc \left ( dx+c \right ) -\cot \left ( dx+c \right ) \right ) }{d}}+{\frac{{b}^{2}\cos \left ( dx+c \right ) \sin \left ( dx+c \right ) }{2\,d}}+{\frac{{b}^{2}x}{2}}+{\frac{{b}^{2}c}{2\,d}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 2.59493, size = 107, normalized size = 1.37 \begin{align*} -\frac{4 \,{\left (d x + c + \frac{1}{\tan \left (d x + c\right )}\right )} a^{2} -{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} b^{2} - 4 \, a b{\left (2 \, \cos \left (d x + c\right ) - \log \left (\cos \left (d x + c\right ) + 1\right ) + \log \left (\cos \left (d x + c\right ) - 1\right )\right )}}{4 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.64996, size = 308, normalized size = 3.95 \begin{align*} -\frac{b^{2} \cos \left (d x + c\right )^{3} + 2 \, a b \log \left (\frac{1}{2} \, \cos \left (d x + c\right ) + \frac{1}{2}\right ) \sin \left (d x + c\right ) - 2 \, a b \log \left (-\frac{1}{2} \, \cos \left (d x + c\right ) + \frac{1}{2}\right ) \sin \left (d x + c\right ) +{\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right ) +{\left ({\left (2 \, a^{2} - b^{2}\right )} d x - 4 \, a b \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, d \sin \left (d x + c\right )} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \int \left (a + b \sin{\left (c + d x \right )}\right )^{2} \cot ^{2}{\left (c + d x \right )}\, dx \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 2.23738, size = 200, normalized size = 2.56 \begin{align*} \frac{4 \, a b \log \left ({\left | \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) \right |}\right ) + a^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) -{\left (2 \, a^{2} - b^{2}\right )}{\left (d x + c\right )} - \frac{4 \, a b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) + a^{2}}{\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )} - \frac{2 \,{\left (b^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{3} - 4 \, a b \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} - b^{2} \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) - 4 \, a b\right )}}{{\left (\tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]